﻿<?php
require_once('../db/check_login.php');
require_once('../db/config.php');
$db=new db($config);
?>
<form name="form1" method="post" action="">
<table width="100%" border="0">
 <tr>
    <td colspan="2">添加分类</td>
  </tr>
  <tr>
    <td width="6%">名称</td>
    <td width="94%">
      <label for="name"></label>
      <input type="text" name="name" id="name">
   </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="sub" id="sub" value="提交"></td>
  </tr>
</table>
 </form>
<?php
if(isset($_POST['sub'])){
$name=$_POST['name'];
$data=array();
$data['name']=$name;
if(isset($_GET['id'])){
$data['parentId']=$_GET['id'];	
}
if(isset($_GET['grand'])){
$data['grand']=$_GET['grand']+1;			
}
$row=$db->insert('artclass',$data);
if($row>0){
echo '<script type="text/javascript">alert("操作成功");location=("list.php");</script>';	
}
  }
?>

